package servlet;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "Servlet14", value = "/x")
public class Servlet14 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=utf-8");
        String username = request.getParameter("username");
        System.out.println("X资源接到了参数:"+username);
        //请求转发（转发时的斜杠“/”表示的含义是当前的应用程序）
        // 重定向的时候的斜杠“/”表示的含义是当前服务器，不是当前应用程序
        request.getRequestDispatcher("/y").forward(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
